package com.javacode2018.lesson001.demo3;

/**
 * @Author: hongsir
 * @Date: 2024/10/9 - 10 - 09 - 16:28
 * @Description: com.javacode2018.lesson001.demo3
 * @Version: 1.0
 */
public class UserStaticFactory {

    /**
     * 静态午餐方法创建UserModel
     *
     * @return
     */
    public static UserModel buildUser1(){
        System.out.println(UserStaticFactory.class + ".buildUser1()");
        UserModel userModel = new UserModel();
        userModel.setName("我是无参静态构造方法创建的！");
        return userModel;
    }

    /**
     * 静态有参方法创建UserModel
     *
     * @param   name    名称
     * @age     age     年龄
     * @return
     */
    public static UserModel buildUser2(String name, int age){
        System.out.println(UserStaticFactory.class + ".buildUser2()");

        UserModel userModel = new UserModel();
        userModel.setName(name);
        userModel.setAge(age);
        return userModel;
    }
}
